#ifndef _VIN_COMMON_H_
#define _VIN_COMMON_H_

#include <linux/ioctl.h>
#include "mpi_common.h"

#ifdef  __cplusplus
extern "C"
{
#endif



//////////////////////////////////////////////////



#define SGKS_SENSOR_IOC_MAGIC                        's'
#define _SENSOR_IOR(IOCTL, param)                    _IOR(SGKS_SENSOR_IOC_MAGIC, IOCTL, param)
#define SGKS_SENWOR_IOCTL_OPERATION_VALUE         (0x1001005)
#define SGKS_SENWOR_IOCTL_OPERATION                _SENSOR_IOR(SGKS_SENWOR_IOCTL_OPERATION_VALUE, struct __msg_t*)


#define SGKS_SENSOR_DRV_BUFF(_ptr)                               \
	msg_t ioctl_msg;				                            	\
	memset(ioctl_msg.msg_data, 0, sizeof(ioctl_msg.msg_data));  	\
	_ptr = ioctl_msg.msg_data;

#define SGKS_SENSOR_DRV_CLEAN_DATABUFF()                         \
	memset(ioctl_msg.msg_data, 0, sizeof(ioctl_msg.msg_data));  	 \

#define SGKS_SENSOR_DRV_IOCTL_RETURN_VALUE()                         \
	ioctl_msg.msg_head.ack_flag                                \


#define SGKS_SENSOR_DRV_IOCTL(_Msgtype, _MsgSubType, _MsgDataLen, _sensor_id ,_err_ret)      				\
	memset(&ioctl_msg.msg_head, 0, sizeof(ioctl_msg.msg_head));     						  						\
	ioctl_msg.msg_head.msg_type     = _Msgtype;							                      					\
    ioctl_msg.msg_head.msg_subtype  = _MsgSubType;																	\
	ioctl_msg.msg_head.msg_size     = _MsgDataLen;																	\
	if (_sensor_id >= 4)																							\
	{																												\
		Printf("ioctl msg sensor id err\n");																		\
		return _err_ret;																							\
	}																												\
	if (_MsgDataLen > sizeof(ioctl_msg.msg_data))																	\
	{																												\
		Printf("ioctl msg len err\n");																				\
		return _err_ret;										    												\
	}																												\
	if (ioctl(mpi_get_managerHanle()->sensor_handle[_sensor_id][mpi_get_managerHanle()->curr_module_id], SGKS_SENWOR_IOCTL_OPERATION, &ioctl_msg) < 0)	\
    {																												\
      	Printf("ioctl msg send err.\n");   																			\
        return _err_ret;																							\
    }

#define SGKS_SENSOR_DRV_IOCTL_EX(_Fd, _Msgtype, _MsgSubType, _MsgDataLen, _err_ret)      	\
	memset(&ioctl_msg.msg_head, 0, sizeof(ioctl_msg.msg_head));     						  		\
	ioctl_msg.msg_head.msg_type     = _Msgtype;							                      	\
    ioctl_msg.msg_head.msg_subtype  = _MsgSubType;													\
	ioctl_msg.msg_head.msg_size     = _MsgDataLen;													\
	if (_MsgDataLen > sizeof(ioctl_msg.msg_data))													\
	{																								\
		Printf("ioctl msg len err\n");																\
		return _err_ret;										    								\
	}																								\
	if (ioctl(_Fd, SGKS_SENWOR_IOCTL_OPERATION, &ioctl_msg) < 0)										\
    {																								\
      	Printf("ioctl msg send err.\n");   															\
        return _err_ret;																			\
    }

//////////////////////////////////////////////////

#define SGKS_MPI_VIDEO_MODE(W,H,F,PI)         (((PI<<31)&0x80000000)|((F<<24)&0x3F000000)|(((W/4)<<12)&0x00FFF000)|((H/2)&0x00000FFF))
#define SGKS_MPI_VIDEO_MODE_GET_WIDTH(mode)   ((mode&0x00FFF000)>>10)
#define SGKS_MPI_VIDEO_MODE_GET_HEIGTH(mode)  ((mode&0x00000FFF)<<1)
#define SGKS_MPI_VIDEO_MODE_GET_FPS(mode)     ((mode&0x3F000000)>>24)
#define SGKS_MPI_VIDEO_MODE_GET_PI(mode)      ((mode&0x80000000)>>31)
#define SGKS_MPI_VIDEO_MODE_GET_MODE(mode)    (mode&0x00FFFFFF)
#define SGKS_MPI_VIDEO_MODE_AUTO              (0)

//////////////////////////////////////////////////

//#define SGKS_VIDEO_FPS(fps)                       (512000000 / fps)
#define SGKS_VIDEO_FPS_AUTO                       0           //0
#define SGKS_VIDEO_FPS_1                          512000000   //(512000000 / 1)
#define SGKS_VIDEO_FPS_2                          256000000   //(512000000 / 2)
#define SGKS_VIDEO_FPS_3                          170666667   //(512000000 / 3)
#define SGKS_VIDEO_FPS_4                          128000000   //(512000000 / 4)
#define SGKS_VIDEO_FPS_5                          102400000   //(512000000 / 5)
#define SGKS_VIDEO_FPS_6                          85333333    //(512000000 / 6)
#define SGKS_VIDEO_FPS_10                         51200000    //(512000000 / 10)
#define SGKS_VIDEO_FPS_12                         42666667    //(512000000 / 12)
#define SGKS_VIDEO_FPS_13                         39384615    //(512000000 / 13)
#define SGKS_VIDEO_FPS_14                         36571428    //(512000000 / 14)
#define SGKS_VIDEO_FPS_15                         34133333    //(512000000 / 15)
#define SGKS_VIDEO_FPS_20                         25600000    //(512000000 / 20)
#define SGKS_VIDEO_FPS_24                         21333333    //(512000000 / 24)
#define SGKS_VIDEO_FPS_25                         20480000    //(512000000 / 25)
#define SGKS_VIDEO_FPS_30                         17066667    //(512000000 / 30)
#define SGKS_VIDEO_FPS_50                         10240000    //(512000000 / 50)
#define SGKS_VIDEO_FPS_60                          8533333    //(512000000 / 60)
#define SGKS_VIDEO_FPS_120                         4266667    //(512000000 / 120)
#define SGKS_VIDEO_FPS_29_97                      17083750    //(512000000 / 2997 * 100)
#define SGKS_VIDEO_FPS_59_94                       8541875    //(512000000 / 5994 * 100)
#define SGKS_VIDEO_FPS_23_976                     21354688    //(512000000 / 23976 * 1000)
#define SGKS_VIDEO_FPS_12_5                       40960000    //(512000000 / 25 * 2)
#define SGKS_VIDEO_FPS_6_25                       81920000    //(512000000 / 25 * 4)
#define SGKS_VIDEO_FPS_3_125                     163840000    //(512000000 / 25 * 8)
#define SGKS_VIDEO_FPS_7_5                        68266667    //(512000000 / 15 * 2)
#define SGKS_VIDEO_FPS_3_75                      136533333    //(512000000 / 15 * 4)

typedef enum
{
    SGKS_SENSOR_OPERATION_GETVER   = 0x10001,
    SGKS_SENSOR_OPERATION_START,
    SGKS_SENSOR_OPERATION_RESET,
    SGKS_SENSOR_OPERATION_INIT_HW,
    SGKS_SENSOR_OPERATION_GET_VIDEOINFO,
    SGKS_SENSOR_OPERATION_GETINFO,
    SGKS_SENSOR_OPERATION_GETCAPABILITY,
    SGKS_SENSOR_OPERATION_CHECK_VIDEO_MODE,
    SGKS_SENSOR_OPERATION_SET_VIDEO_MODE,
    SGKS_SENSOR_OPERATION_SELEC_CHANNEL,
    SGKS_SENSOR_OPERATION_GET_SHUTTER_INFO,
    SGKS_SENSOR_OPERATION_GET_VBLANK_TIME,
    SGKS_SENSOR_OPERATION_GET_SENSOR_TEMPERATUE,
    SGKS_SENSOR_OPERATION_GET_SENSOR_INFO,
    SGKS_SENSOR_OPERATION_SET_FPS,
    
    SGKS_SENSOR_OPERATION_SET_UPDATE_REG,
    SGKS_SENSOR_OPERATION_SET_AGC_DB,
    SGKS_SENSOR_OPERATION_SET_SHUTTER_TIME,
    SGKS_SENSOR_OPERATION_SET_STILL_MODE,
    SGKS_SENSOR_OPERATION_GET_STILL_MODE,
    SGKS_SENSOR_OPERATION_SET_LOW_LIGHT_AGC,
    SGKS_SENSOR_OPERATION_SET_SLOWSHUTTER_MODE,
    SGKS_SENSOR_OPERATION_SET_ANTI_FLICKER,
    SGKS_SENSOR_OPERATION_SET_DGAIN_RATIO,
    SGKS_SENSOR_OPERATION_GET_DGAIN_RATIO,
    SGKS_SENSOR_OPERATION_SET_OPERATION_MODE,
    SGKS_SENSOR_OPERATION_DUMP_REG,
    SGKS_SENSOR_OPERATION_GET_DEV_ID,
    SGKS_SENSOR_OPERATION_SET_REG,
    SGKS_SENSOR_OPERATION_GET_REG,
    
    SGKS_SENSOR_OPERATION_SET_MIRROR_MODE,
    SGKS_SENSOR_OPERATION_GET_MIRROR_MODE,
    SGKS_SENSOR_OPERATION_GET_AGC_INFO,
    SGKS_SENSOR_OPERATION_GET_FRAME_RATE,
    SGKS_SENSOR_OPERATION_GET_GAIN_DB,
    SGKS_SENSOR_OPERATION_GET_SHUTTER_TIME,
    SGKS_SENSOR_OPERATION_GET_VIDEO_MODE,
    SGKS_SENSOR_OPERATION_GET_OPERATION_MODE,
    SGKS_SENSOR_OPERATION_GET_SLOWSHUTTER_MODE,

    SGKS_SENSOR_OPERATION_SET_BAYER_PATTERN = 0x20001,
    SGKS_SENSOR_OPERATION_GET_BAYER_PATTERN,
    SGKS_SENSOR_OPERATION_GET_ALL_VIDEO_MODE,
    SGKS_SENSOR_OPERATION_SET_PRINT_DEFAULT_REG,
    SGKS_SENSOR_OPERATION_SENSOR_REG_DEBUG,
} SGKS_SENSOR_OPERATION_ID_E;

#define SGKS_SENSOR_OPERATION_SUCCESS       (0)
#define SGKS_SENSOR_OPERATION_FAIL          (-1)
#define SGKS_SENSOR_OPERATION_ERR_VER       (-10001)
#define SGKS_SENSOR_OPERATION_ERR_ID   		(-10002)
#define SGKS_SENSOR_OPERATION_ERR_DATA 		(-10003)
#define SGKS_SENSOR_OPERATION_ERR_SYS  		(-10004)



typedef struct __SGKS_SENSOR_VER
{
    u8     version[16];
    u8     reserved[4];
} SGKS_SENSOR_VER_S;

typedef enum
{
	SGKS_VI_LINEAR_MODE                           = 0x00,
	SGKS_VI_HDR_MODE,
} SGKS_VI_SENSOR_OP_MODE_E;

#if 0
typedef enum
{
    SGKS_VIDEO_MODE_MISC_FIRST        =  0,
    SGKS_VIDEO_MODE_AUTO              =  0,

    SGKS_VIDEO_MODE_320_240           =  1,       //320x240
    SGKS_VIDEO_MODE_320_288           =  2,       //320x288
    SGKS_VIDEO_MODE_360_240           =  3,       //360x240
    SGKS_VIDEO_MODE_360_288           =  4,       //360x288
    SGKS_VIDEO_MODE_480_240           =  5,       //480x240
    SGKS_VIDEO_MODE_720_240           =  6,       //720x240
    SGKS_VIDEO_MODE_960_240           =  7,       //960x240
    SGKS_VIDEO_MODE_VGA               =  8,       //640x480
    SGKS_VIDEO_MODE_SVGA              =  9,       //800x600
    SGKS_VIDEO_MODE_XGA               = 10,       //1024x768
    SGKS_VIDEO_MODE_SXGA              = 11,       //1280x1024
    SGKS_VIDEO_MODE_UXGA              = 12,       //1600x1200
    SGKS_VIDEO_MODE_QXGA              = 13,       //2048x1536
    SGKS_VIDEO_MODE_WVGA              = 14,       //800x480
    SGKS_VIDEO_MODE_WSVGA             = 15,       //1024x600
    SGKS_VIDEO_MODE_1280_960          = 16,       //1280x960
    SGKS_VIDEO_MODE_WXGA              = 17,       //1280x800
    SGKS_VIDEO_MODE_WSXGA             = 18,       //1440x900
    SGKS_VIDEO_MODE_WSXGAP            = 19,       //1680x1050
    SGKS_VIDEO_MODE_WUXGA             = 20,       //1920x1200

    /* Add new format below and update SGKS_VIDEO_MODE_NUM */
    SGKS_VIDEO_MODE_480_640           = 21,       //480x640
    SGKS_VIDEO_MODE_SXGAP             = 22,       //1400x1050
    SGKS_VIDEO_MODE_QSXGA             = 23,       //2592x1944
    SGKS_VIDEO_MODE_HVGA              = 24,       //320x480
    SGKS_VIDEO_MODE_480_800           = 25,       //480x800
    SGKS_VIDEO_MODE_2048_1152         = 26,       //2048x1152
    SGKS_VIDEO_MODE_1920_1440         = 27,       //1920x1440
    SGKS_VIDEO_MODE_2560x1440         = 28,       //2560x1440, 3.7MP
    SGKS_VIDEO_MODE_2208x1242         = 29,       //2208x1242, 2.7MP
    SGKS_VIDEO_MODE_2304x1296         = 30,       //2304x1296
    SGKS_VIDEO_MODE_2304x1536         = 31,       //2304x1536, 3.4MP
    SGKS_VIDEO_MODE_240_400           = 32,       //240x400
    SGKS_VIDEO_MODE_2160P30           = 33,       //3840x2160@30fps
    SGKS_VIDEO_MODE_2160P25           = 34,       //3840x2160@25fps
    SGKS_VIDEO_MODE_2160P24           = 35,       //3840x2160@24fps
    SGKS_VIDEO_MODE_2160P24_SE        = 36,       //4096x2160@24fps, SMPTE
    SGKS_VIDEO_MODE_HDMI_NATIVE       = 37,       //Best Native Resolution
    SGKS_VIDEO_MODE_720P24            = 38,       //720p24
    SGKS_VIDEO_MODE_720P25            = 39,       //720p25
    SGKS_VIDEO_MODE_720P30            = 40,       //720p30
    SGKS_VIDEO_MODE_1296P60           = 41,       //2304x1296@60fps
    SGKS_VIDEO_MODE_1152x648          = 42,       //1152x648
    SGKS_VIDEO_MODE_4096x2160         = 43,       //4096x2160
    SGKS_VIDEO_MODE_4016x3016         = 44,       //4016x3016
    SGKS_VIDEO_MODE_4000x3000         = 45,       //4000x3000
    SGKS_VIDEO_MODE_960_540           = 46,       //960x540
    SGKS_VIDEO_MODE_3280_2464         = 47,       //3280x2464
    SGKS_VIDEO_MODE_3280_1852         = 48,       //3280x1852
    SGKS_VIDEO_MODE_2520_1424         = 49,       //2520x1424
    SGKS_VIDEO_MODE_1640_1232         = 50,       //1640x1232
    SGKS_VIDEO_MODE_2048_1080         = 51,       //2048x1080
    SGKS_VIDEO_MODE_3840x2160         = 52,       //3840x2160
    SGKS_VIDEO_MODE_768_512           = 53,       //768x512
    SGKS_VIDEO_MODE_FWVGA             = 54,       //854x480
    SGKS_VIDEO_MODE_1296_972          = 55,       //1296x972
    SGKS_VIDEO_MODE_640_400           = 56,       //640x400
    SGKS_VIDEO_MODE_1296_1032         = 57,       //1296x1032
    SGKS_VIDEO_MODE_3264_2448         = 58,       //3264x2448
    SGKS_VIDEO_MODE_2304_1836         = 59,       //2304x1836
    SGKS_VIDEO_MODE_3264_1836         = 60,       //3264x1836
    SGKS_VIDEO_MODE_2208_1836         = 61,       //2208x1836
    SGKS_VIDEO_MODE_1280_918          = 62,       //1280x918
    SGKS_VIDEO_MODE_816_612           = 63,       //816x612
    SGKS_VIDEO_MODE_320_306           = 64,       //320x306
    SGKS_VIDEO_MODE_3072_2048         = 65,       //3072x2048
    SGKS_VIDEO_MODE_2592_1944         = 66,       //2592x1944
    SGKS_VIDEO_MODE_1536_1024         = 67,       //1536x1024
    SGKS_VIDEO_MODE_2560_2048         = 68,       //2560x2048
    SGKS_VIDEO_MODE_1080P15           = 69,       //1080p15
    SGKS_VIDEO_MODE_1280_960P30       = 70,       //1280x960@30
    SGKS_VIDEO_MODE_1280_960P25       = 71,       //1280x960@25
    SGKS_VIDEO_MODE_480_854           = 72,       //480x854@30 //SH-L
    SGKS_VIDEO_MODE_1920_480          = 73,       //480x854@30 //SH-L
    SGKS_VIDEO_MODE_1280_320          = 74,       //480x854@30 //SH-L
    SGKS_VIDEO_MODE_1280_272          = 75,       //480x854@30 //SH-L
    SGKS_VIDEO_MODE_480_1280          = 76,       //480x854@30 //SH-L
    SGKS_VIDEO_MODE_400_1280          = 77,       //480x854@30 //SH-L
    SGKS_VIDEO_MODE_MISC_LAST,

    SGKS_VIDEO_MODE_OFF               = 0xF000,
    //Still Standard
    SGKS_VIDEO_MODE_STILL_FIRST       = 0xFFE0,
    SGKS_VIDEO_MODE_3M_4_3            = 0xFFE0,
    SGKS_VIDEO_MODE_3M_16_9           = 0xFFE1,
    SGKS_VIDEO_MODE_4M_4_3            = 0xFFE2,
    SGKS_VIDEO_MODE_4M_16_9           = 0xFFE3,
    SGKS_VIDEO_MODE_5M_4_3            = 0xFFE4,
    SGKS_VIDEO_MODE_5M_16_9           = 0xFFE5,   //2976x1674
    SGKS_VIDEO_MODE_STILL_LAST,

    //Video Standard
    SGKS_VIDEO_MODE_STANDARD_FIRST    = 0xFFF0,
    SGKS_VIDEO_MODE_480I              = 0xFFF0,
    SGKS_VIDEO_MODE_576I              = 0xFFF1,
    SGKS_VIDEO_MODE_D1_NTSC           = 0xFFF2,   //480p
    SGKS_VIDEO_MODE_D1_PAL            = 0xFFF3,   //576p
    SGKS_VIDEO_MODE_720P              = 0xFFF4,
    SGKS_VIDEO_MODE_720P_PAL          = 0xFFF5,   //720p50
    SGKS_VIDEO_MODE_1080I             = 0xFFF6,
    SGKS_VIDEO_MODE_1080I_PAL         = 0xFFF7,   //1080i50
    SGKS_VIDEO_MODE_1080P             = 0xFFF8,
    SGKS_VIDEO_MODE_1080P_PAL         = 0xFFF9,   //1080p50
    SGKS_VIDEO_MODE_1080I48           = 0xFFFA,   //1080i48
    SGKS_VIDEO_MODE_1080P24           = 0xFFFB,   //1080p24
    SGKS_VIDEO_MODE_1080P25           = 0xFFFC,   //1080p25
    SGKS_VIDEO_MODE_1080P30           = 0xFFFD,   //1080p30
    SGKS_VIDEO_MODE_1080P60           = 0xFFFE,
    SGKS_VIDEO_MODE_STANDARD_LAST     = 0xFFFF,

    SGKS_VIDEO_MODE_TEST              = 0xFFFE,
    SGKS_VIDEO_MODE_MAX               = 0xFFFF,
} SGKS_VIDEO_MODE_E;
#endif

typedef enum
{
    SGKS_SENSOR_SCAN_INTERLACE     =  0,
    SGKS_SENSOR_SCAN_PROGRESSIVE
} SGKS_SENSOR_SCAN_E;


typedef enum
{
    SGKS_PLL_MODE_1080P_FPS25_30    = 0,
    SGKS_PLL_MODE_720P_FPS50_60 = 0,
    SGKS_PLL_MODE_960P_FPS25_30 ,
    SGKS_PLL_MODE_720P_FPS25_30 ,
} SGKS_PLL_MODE_E;

#define SGKS_VI_DEV_TYPE_CMOS                         (0x01 << 0)
#define SGKS_VI_DEV_TYPE_CCD                          (0x01 << 1)
#define SGKS_VI_DEV_TYPE_DECODER                      (0x01 << 2)

#define SGKS_VIDEO_SYSTEM_AUTO                (0x0)
#define SGKS_VIDEO_SYSTEM_NTSC                (0x1)
#define SGKS_VIDEO_SYSTEM_PAL                 (0x2)
#define SGKS_VIDEO_SYSTEM_SECAM               (0x4)
#define SGKS_VIDEO_SYSTEM_ALL                 (0xF)

typedef enum
{
    SGKS_VI_INPUT_FORMAT_RGB_RAW                  = 0x00,
    SGKS_VI_INPUT_FORMAT_YUV_422_INTLC,
    SGKS_VI_INPUT_FORMAT_YUV_422_PROG,
} SGKS_VI_INPUT_FORMAT_E;

typedef struct sgks_vi_cap_info
{
    u16 s_ctrl_reg;
    u16 s_inp_cfg_reg;
    u16 prog_opt            : 4;
    u16 num_extra_vi        : 4;
    u16 reserved            : 8;
    u16 s_v_width_reg;
    u16 s_h_width_reg;
    u16 s_h_offset_top_reg;
    u16 s_h_offset_bot_reg;
    u16 s_v_reg;
    u16 s_h_reg;
    u16 s_min_v_reg;
    u16 s_min_h_reg;
    u16 s_trigger_0_start_reg;
    u16 s_trigger_0_end_reg;
    u16 s_trigger_1_start_reg;
    u16 s_trigger_1_end_reg;
    u16 s_vo_start_0_reg;
    u16 s_vo_start_1_reg;
    u16 s_cap_start_v_reg;
    u16 s_cap_start_h_reg;
    u16 s_cap_end_v_reg;
    u16 s_cap_end_h_reg;
    u16 s_blank_leng_h_reg;
    u16 s_timeout_v_low_reg;
    u16 s_timeout_v_high_reg;
    u16 s_timeout_h_low_reg;
    u16 s_timeout_h_high_reg;
    u16 mipi_cfg1_reg;
    u16 mipi_cfg2_reg;
    u16 mipi_bdphyctl_reg;
    u16 mipi_sdphyctl_reg;
    u32 extra_vi_setup_addr[4];
    u32 rawH;
    u8  is_turbo_ena;
    u32 MIPI_enable;
    u32 mipi_timing1;
    u32 mipi_timing2;
} sgks_vi_cap_info_s;

typedef struct vi_black_level_compensation
{
    s16     bl_oo;
    s16     bl_oe;
    s16     bl_eo;
    s16     bl_ee;
} SGKS_VI_BLACK_LEVEL_COMPENSATION_S;

#define SGKS_VI_MAX_FPS_TABLE_SIZE                    (0x100)

typedef struct sgks_vi_src_capability
{
    u8  input_type;                             // SGKS_VIDEO_TYPE
    u8  dev_type;                               // SGKS_VI_SRC_DEV_TYPE
    u32 frame_rate;                             // SGKS_VIDEO_FPS
    u8  video_format;                           // SGKS_VIDEO_FORMAT
    u8  bit_resolution;                         // SGKS_VIDEO_BITS
    u8  aspect_ratio;                           // SGKS_VIDEO_RATIO
    u8  video_system;                           // SGKS_VIDEO_SYSTEM
    u8  ext_fps[SGKS_VI_MAX_FPS_TABLE_SIZE];      // SGKS_VIDEO_FPS

    u16 max_width;
    u16 max_height;
    u16 def_cap_w;
    u16 def_cap_h;
    u16 cap_start_x;
    u16 cap_start_y;
    u16 cap_width;
    u16 cap_height;

    // Valid when dev_type == SGKS_VI_DEV_TYPE_CMOS or SGKS_VI_DEV_TYPE_CCD
    // DSP CMD(SGKS_DSP_CMD_SENSOR_INPUT_SETUP & SGKS_DSP_CMD_VIDEO_PREPROCESSING)
    u8  sensor_id;
    u8  bayer_pattern;
    u8  field_format;
    u8  active_capinfo_num;
    u8  bin_max;
    u8  skip_max;
    u32 sensor_readout_mode;
    u8  input_format;
    u8  column_bin;
    u8  row_bin;
    u8  column_skip;
    u8  row_skip;

    u32 mode_type;
    u32 current_vi_mode;
    u32 current_shutter_time;
    s32 current_gain_db;
    SGKS_VI_BLACK_LEVEL_COMPENSATION_S    current_sw_blc;
    u32 current_fps;
    sgks_vi_cap_info_s                vi_cap_info;
} sgks_vi_src_capability_s;



typedef struct __SGKS_SENSOR_CONFIG_PARAM
{
    u16  cap_start_x;
    u16  cap_start_y;
    u16  cap_width;
    u16  cap_height;
    SGKS_SENSOR_SCAN_E sacn_mode;
    u32 frame_rate;
    u32 shutter_time;
    SGKS_PLL_MODE_E pll_mode;
    s32 agc_db;
    u32 agc_index;
    u32 slowshutter_mode;
    u32 mirror_mode;
    u8  reserved[4];
} SGKS_SENSOR_CONFIG_PARAM_S;

typedef struct vi_reg_data
{
    u32 reg;
    u32 data;
    u32 regmap;
} SGKS_VI_REG_DATA_S;

typedef struct
{
    u32 width;
    u32 height;
    u32 fps;
    u32 video_mode;
} SGKS_VI_RESOLUTION_DATA_S;

typedef struct
{
    u32 num;
    SGKS_VI_RESOLUTION_DATA_S list[20];
} SGKS_VI_RESOLUTION_S;

typedef struct
{
    u32 id;
    u32 video_mode;
} SGKS_VI_STREAM_MODE_S;


typedef struct
{
    u32 enable;
    u32 input_interface;
    u32 input_type;

    u32 mirror_mode;
    u32 bayer_pattern;
    u32 video_mode;

    u32 cap_start_x;
    u32 cap_start_y;
    u32 cap_width;
    u32 cap_height;
} SGKS_VI_STREAM_INFO_S;

typedef struct
{
    u32 num;
    SGKS_VI_STREAM_INFO_S stream_info[4];
} SGKS_VI_STREAM_START_S;

typedef struct __SGKS_SENSOR_REG_DEBUG_INFO_S
{
    int    rd_wr_flag;
    int    stream_id;
    int    dev_id;
    unsigned int reg_addr;
    unsigned int reg_data;
} SGKS_SENSOR_REG_DEBUG_INFO_S;


#ifdef  __cplusplus
}
#endif

#endif


